﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:BindingConverters="clr-namespace:Meridian.BindingConverters">
    <BindingConverters:BeginTimeConverter x:Key="BeginTimeConverter"/>
    <DataTemplate x:Key="MyAudioItemTemplate">
        <Grid MinHeight="35" Margin="5,10,5,10">
            <Grid.RenderTransform>
                <TranslateTransform />
            </Grid.RenderTransform>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="5"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Grid.Triggers>
                <EventTrigger RoutedEvent="Grid.Loaded">
                    <BeginStoryboard>
                        <Storyboard>
                            <Storyboard>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)">
                                    <DiscreteDoubleKeyFrame KeyTime="0" Value="-15"/>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity">
                                    <DiscreteDoubleKeyFrame KeyTime="0" Value="0"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard BeginTime="{Binding Converter={StaticResource BeginTimeConverter}}">
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)">
                                    <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0">
                                        <EasingDoubleKeyFrame.EasingFunction>
                                            <ExponentialEase EasingMode="EaseOut" Exponent="6"/>
                                        </EasingDoubleKeyFrame.EasingFunction>
                                    </EasingDoubleKeyFrame>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity">
                                    <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1">
                                        <EasingDoubleKeyFrame.EasingFunction>
                                            <ExponentialEase EasingMode="EaseOut" Exponent="6"/>
                                        </EasingDoubleKeyFrame.EasingFunction>
                                    </EasingDoubleKeyFrame>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Grid.Triggers>
            <TextBlock VerticalAlignment="Center" Text="{Binding Title}"  FontFamily="../Fonts/#Segoe WP" FontSize="16" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" MaxHeight="60"/>
            <TextBlock Grid.Row="1" Text="{Binding Artist}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"  FontFamily="../Fonts/#Segoe WP Light" FontSize="12" Opacity="0.6"/>
            <TextBlock Grid.Column="2" Grid.Row="0" Text="{Binding Duration, StringFormat='m\\:ss'}" FontSize="12" Opacity="0.6"/>
        </Grid>
    </DataTemplate>
</ResourceDictionary>